﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Views
{
    /// <summary>
    /// Interface implemented by the application that provides the actual implementation of each view so that
    /// there is a way for the presenters etc. to launch views without having to know about the implemetation of those views
    /// </summary>
    public interface IViewFactory
    {
        /// <summary>
        /// Show the Edit Database view
        /// </summary>
        /// <param name="dataBaseToEdit">The database we are editing</param>
        /// <param name="parentView">A parent view that will "own" this view</param>
        void EditDatabase(Models.Database dataBaseToEdit, IView parentView);

        /// <summary>
        /// Show the Add Database view
        /// </summary>
        /// <param name="parentQueryTab">The QueryTab view we are adding the databases to</param>
        /// <param name="parentView">A parent view that will "own" this view</param>
        void AddDatabase(IQueryView parentQueryTab, IView parentView);

        /// <summary>
        /// Show the Remove Databases view
        /// </summary>
        /// <param name="parentQueryTab">The QueryTab view we are removing the databases from</param>
        /// <param name="parentView">A parent view that will "own" this view</param>
        void RemoveDatabases(IQueryView parentQueryTab, IView parentView);

        /// <summary>
        /// Show the Database LList Upgrade view
        /// </summary>
        /// <param name="dbListToUpgrade">The list of databases we will be upgrading</param>
        /// <param name="parentView">A parent view that will "own" this view</param>
        void DBListUpgrade(List<Models.Database> dbListToUpgrade, IView parentView);

        /// <summary>
        /// Export the result sets associated with a list of databases
        /// </summary>
        /// <param name="dbListToExport">The list of databases that contain result sets to export</param>
        /// <param name="parentView">A parent view that will "own" this view</param>
        void ExportResults(List<Models.Database> dbListToExport, IView parentView);

        /// <summary>
        /// Show a dialog with a list of querys to save and ask the user to select the ones that they want to save
        /// </summary>
        /// <param name="queryViewsToSave">The list of possible queries to save</param>
        /// <param name="parentView">The parent view</param>
        /// <returns>A List of the querys the user has selected to save or NULL is cancel was pressed</returns>
        List<IQueryView> SaveItems(List<IQueryView> queryViewsToSave, IView parentView);

        /// <summary>
        /// Show the About view
        /// </summary>
        /// <param name="parentView">A parent view that will "own" this view</param>
        void About(IView parentView);

        /// <summary>
        /// Ask the user a question and return the result
        /// </summary>
        /// <param name="message">The message to display</param>
        /// <param name="title">The title of the message</param>
        /// <param name="showCancel">If true then a "Cancel" button is shown</param>
        /// <returns>True if the user clicks "Yes", false if th euser clicks "No" or null if the user clicks "Cancel"</returns>
        bool? AskQuestion(string message, string title, bool showCancel);

        /// <summary>
        /// Display an error message to the user
        /// </summary>
        /// <param name="message">The error mesage text</param>
        /// <param name="title">The title of the error message</param>
        void DisplayError(string message, string title);

        /// <summary>
        /// Display an information message to the user
        /// </summary>
        /// <param name="message">The mesage text</param>
        /// <param name="title">The title of the error message</param>
        void DisplayMessage(string message, string title);

        /// <summary>
        /// Show an open file dialog and return the name of the file selected, or string.empty if Cancel was clicked
        /// </summary>
        /// <param name="title">The title for the open file dialog</param>
        /// <param name="defaultExt">The default extension</param>
        /// <param name="filters">The filters to add to the list of file types</param>
        /// <param name="parentView">A parent view that will "own" this view</param>
        /// <returns>The file name or string.empty if cancel was pressed</returns>
        string GetFileToOpen(string title, string defaultExt, string filters, IView parentView);

        /// <summary>
        /// Show a save as dialog box and return a file name to save data with, or string.Empty if cancel was clicked
        /// </summary>
        /// <param name="title">The dialog title</param>
        /// <param name="defaultExt">The default extension to use</param>
        /// <param name="filters">The filters to add the list of file types</param>
        /// <param name="defaultFileName">The default file name to suggest as a file name to save under</param>
        /// <param name="parentView">A parent view that will "own" this view</param>
        /// <returns>The file name or string.empty if cancel was pressed</returns>
        string GetFileToSave(string title, string defaultExt, string filters, string defaultFileName, IView parentView);
    }
}
